#ifndef VECTOR3_H
#define VECTOR3_H

// Three-dimensional fixed-point vectors.

typedef struct vector3 {
	fixed_t x;
	fixed_t y;
	fixed_t z;
} vector3_t;

void vector3_add(const vector3_t *a, const vector3_t *b, vector3_t *out); // out = a + b
void vector3_sub(const vector3_t *a, const vector3_t *b, vector3_t *out); // out = a - b
fixed_t vector3_dot(const vector3_t *a, const vector3_t *b); // dot product
void vector3_cross(const vector3_t *a, const vector3_t *b, vector3_t *out); // cross product
fixed_t vector3_length(const vector3_t *a);
fixed_t vector3_length_squared(const vector3_t *a);
void vector3_normalize(const vector3_t *a, vector3_t *out); // out = a / len(a)
void vector3_transform(const matrix_t *A, const vector3_t *x, vector3_t *out); // out = A * x

extern const vector3_t VECTOR3_UNIT_X;
extern const vector3_t VECTOR3_UNIT_Y;
extern const vector3_t VECTOR3_UNIT_Z;
extern const vector3_t VECTOR3_ZERO;
extern const vector3_t VECTOR3_ONE; // x = y = z = 1

#endif
